﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GHRMS.DAL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class ActivityBLL
    {
        private static readonly ActivityDAL dal = new ActivityDAL();
        ConvertNullable cn = new ConvertNullable();

        public DataSet LoadActivity(Nullable<int> Sequence, Nullable<int> JobSiteSeq
            , Nullable<DateTime> ProjectStartDate, Nullable<DateTime> ProjectEndDate)
        {
            return dal.LoadActivity(Sequence, JobSiteSeq, ProjectStartDate, ProjectEndDate);
        }


        public void Insert(Nullable<int> bgm_proj_oper_seq, string act_descr, string act_type_seq, string job_site_seq
            , string act_limit, Nullable<DateTime> date_sign_start, DateTime date_app_start, DateTime date_app_end
            , Nullable<DateTime> date_sign_end, DateTime date_activity_start, DateTime date_activity_end, string time_sign_end
            , string city_seq, string location_text, string remarks, int created_by)
        {
            int iact_type_seq = Convert.ToInt32(act_type_seq);
            int ijob_site_seq = Convert.ToInt32(job_site_seq);
            int icity_seq = Convert.ToInt32(city_seq);
            int iact_limit = Convert.ToInt32(act_limit);
            int icreated_by = Convert.ToInt32(created_by);

            dal.Insert(bgm_proj_oper_seq, act_descr, iact_type_seq, ijob_site_seq, iact_limit
                , date_sign_start, date_sign_end, date_app_start, date_app_end, date_activity_start
                , date_activity_end, time_sign_end, icity_seq, location_text, remarks, icreated_by);
        }
        public void Update(string act_seq, Nullable<int> bgm_proj_oper_seq, string act_descr, string act_type_seq
            , string job_site_seq, string act_limit
            , Nullable<DateTime> date_sign_start, Nullable<DateTime> date_sign_end, DateTime date_app_start, DateTime date_app_end
            , DateTime date_activity_start, DateTime date_activity_end
            , string time_sign_end, string city_seq, string location_text, string remarks, string updated_by)
        {
            int iact_seq = Convert.ToInt32(act_seq);
            int iact_type_seq = Convert.ToInt32(act_type_seq);
            int ijob_site_seq = Convert.ToInt32(job_site_seq);
            int icity_seq = Convert.ToInt32(city_seq);
            int iact_limit = Convert.ToInt32(act_limit);
            int iupdated_by = Convert.ToInt32(updated_by);

            dal.Update(iact_seq, bgm_proj_oper_seq, act_descr, iact_type_seq, ijob_site_seq, iact_limit
                , date_sign_start, date_sign_end, date_app_start, date_app_end
                , date_activity_start, date_activity_end, time_sign_end, icity_seq, location_text, remarks, iupdated_by);
        }
        public void Delete(string Sequence, string UpdateBy)
        {
            int iact_seq = Convert.ToInt32(Sequence);
            int iupdated_by = Convert.ToInt32(UpdateBy);

            dal.Delete(iact_seq, iupdated_by);
        }
    }
}
